package cn.csust.net2.manager.client.module;
import cn.csust.net2.manager.client.app.App;
import cn.csust.net2.manager.client.panel.EntranceRegistrationPanel;
import cn.csust.net2.manager.client.ux.ServiceCallback;
import cn.csust.net2.manager.shared.po.Student;
import cn.csust.net2.manager.shared.service.SchoolRegisterService;
import cn.csust.net2.manager.shared.service.SchoolRegisterServiceAsync;
import cn.csust.net2.manager.shared.util.ClassForNameAble;
import com.google.gwt.core.client.GWT;
/**
 * 入学登记时候要检查1.当前是否有用户2.当前是否在注册时间之内3.当前用户是否已经注册
 * @author Administrator
 *
 */

@ClassForNameAble
public class SchoolRegister extends BaseModule{
	private EntranceRegistrationPanel panel = null;
	private SchoolRegisterServiceAsync service ;
	private Student student ;
	public SchoolRegister(){
		this.setText("入学登记");
		this.setId("入学登记");
		this.setLayoutOnChange(true);
		this.setClosable(true);
		service = GWT.create(SchoolRegisterService.class);
		student = (Student)(App.getUser());
		if(student.getRegister()==1){
			 init(false);
		}
		else
			service.testRegisterAble(new ServiceCallback<Boolean>() {
				
				@Override
				public void onSuccess(Boolean result) {
					init(result);
					
				}
			});
	}
	private void init(boolean editAble){
		
		
		panel = new EntranceRegistrationPanel(student, editAble);
		addPanel();
	}
	public void addPanel(){
		panel.createForm();
		this.add(panel);
		this.addStyleName("pad-text");
	}
}
